home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** Glue to call UGLibrary in a code resource from a PPC application
- **
- ** by Jim Luther, Apple Developer Technical Support
- **
- ** File: UGLibraryGlue.h
- **
- ** Copyright © 1995 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- #include <Types.h>
- #include <MixedMode.h>
- #include <OSUtils.h>
-
- #include "UGLibrary.h"
-
- /*
- ** The UGLibrary resource type and ID. These must be the same as those in
- ** the UGLibraryGlue.rsrc.make file.
- */
- enum
- {
- kUGLibraryResType = 'CUST',
- kUGLibraryResID = 128
- };
-
-
- /*
- ** The function calling convention for all UGLibrary routines.
- */
- typedef pascal OSErr (*UGProcPtr)(UserGroupPBPtr thePB, Boolean async);
-
- #if GENERATINGCFM
- typedef UniversalProcPtr UGProcUPP;
- #else
- typedef UGProcPtr UGProcUPP;
- #endif
-
- #if GENERATINGCFM
- enum
- {
- uppUGProcInfo = kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UserGroupPBPtr)))
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
- };
- #define CallUGProc(userRoutine, thePB, async) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppUGProcInfo, (thePB), (async))
- #else
- #define CallUGProc(userRoutine, thePB, async) \
- (*(userRoutine))((thePB), (async))
- #endif
-
- #if GENERATINGPOWERPC
- #pragma options align=mac68k
- #endif
-
- /*
- ** Shared struct describing UGLibrary entry points.
- */
- struct UGEntryPoints
- {
- UGProcUPP UGOpenFile;
- UGProcUPP UGCloseFile;
- UGProcUPP UGCreateFile;
-
- UGProcUPP UGNewUser;
- UGProcUPP UGDeleteUser;
- UGProcUPP UGRenameUser;
- UGProcUPP UGGetUserInfo;
- UGProcUPP UGSetUserInfo;
- UGProcUPP UGAuthenticateUser;
-
- UGProcUPP UGNewGroup;
- UGProcUPP UGDeleteGroup;
- UGProcUPP UGRenameGroup;
- UGProcUPP UGGetGroupInfo;
-
- UGProcUPP UGAssignUserToGroup;
- UGProcUPP UGDeleteUserFromGroup;
-
- UGProcUPP UGGetULInfo;
- UGProcUPP UGSetULInfo;
- };
- typedef struct UGEntryPoints UGEntryPoints;
-
- #if GENERATINGPOWERPC
- #pragma options align=reset
- #endif
-
- enum
- {
- uppMainEntryProcInfo = kCStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UGEntryPoints *)))
- };
-